/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package components.shape;

import PCR.MainFrame;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.BorderFactory;
import javax.swing.border.Border;

/**
 *
 * @author icdev
 */
public class ShapeFocusHandler implements FocusListener {

    @Override
    public void focusGained(FocusEvent e) {
        MainFrame frm = (MainFrame) java.awt.Window.getWindows()[0];
        Shape curBand = (Shape) e.getSource();
        frm.setSelectedShape(curBand);
        Border border =  BorderFactory.createDashedBorder(graphics.GraphicsEngin.getComplementaryColor(curBand.getBackground()), 2f, 2f,2f, true);//BorderFactory.createEtchedBorder(Color.lightGray, Color.gray);
        curBand.setBorder(border);
        
        
    }

    @Override
    public void focusLost(FocusEvent e) {
        Shape curBand = (Shape) e.getSource();
        Border border = BorderFactory.createEmptyBorder();
        curBand.setBorder(border);
    }
}
